// 
//  FDApplication.h
//  FiveDice
//  
//  Created by Chris Born.
//  Copyright 2007 Borngraphics. All rights reserved.
//  
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or any later version.
//  
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//  
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//  
//  By contributing code you grant Chris Born and Borngraphics an
//  unlimited, non-exclusive license to your contribution.
//  
//  For support, questions, commercial use, etc...
//  E-Mail: chris <at> borngraphics <dot> com
// 

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <UIKit/UIApplication.h>
#import <UIKit/UIWindow.h>
#import <UIKit/UIView.h>
#import <UIKit/UIView-UIImageViewImplementation.h>
#import <UIKit/UINavigationBar.h>
#import <UIKit/UINavBarButton.h>
#import <UIKit/UINavigationBarBackground.h>
#import <UIKit/UINavigationItem.h>
#import <UIKit/UIHardware.h>
#import <UIKit/UITransformAnimation.h>
#import <UIKit/UIAnimator.h>
#import <UIKit/UITransitionView.h>
#import <UIKit/UIPushButton.h>
#import <UIKit/CDStructures.h>
#import <UIKit/UITextLabel.h>
#import <UIKit/UIAlertSheet.h>
#import <CoreGraphics/CoreGraphics.h>

#import "WebCore/WebFontCache.h"

// FD Classes
#import "common.h"
#import "FDGameView.h"
#import "FDGameMenuView.h"
#import "FDScoreCardView.h"
#import "FDHighScoresView.h"
#import "FDDiePushButton.h"
#import "FDDefaultsController.h"



@interface FDApplication : UIApplication
{
	struct CGRect 			_contentRect;

	UIWindow				*mainWindow;
	UIView					*mainView;
	FDDefaultsController	*defaults;
	
	UINavigationBar			*navBar;
	UINavigationItem		*navBarTitle;
	
	FDGameMenuView			*gameMenuView;
	FDGameView				*gameView;
	FDScoreCardView			*scoreCardView;
	FDHighScoresView		*highScoresView;
	
	NSString				*title;
	
	int					currentState;
	int					previousState;
	BOOL				playing;
}

#pragma mark Application Launch and Suspend
- (void)applicationDidFinishLaunching:(id)unused;
- (void)applicationWillSuspend;

#pragma mark Persistence Methods
- (void)saveGamePosition;

#pragma mark Handle Current State
- (void)finishUserInterfaceForState:(int)state;

#pragma mark Show and Hide Views
- (void)showGameMenu;
- (void)showGameMenuAfterDelay:(NSTimer *)aTimer;
- (void)showGameView;
- (void)waitForNewGameSetup:(NSTimer *)aTimer;
- (void)startNewGame;
- (void)continueLastGameWithOver:(BOOL)over;
- (void)showAboutAlert;

#pragma mark Notification and Delegate Responders
- (void)scoreCardSelectionChanged:(NSNotification *)notification;
- (void)rolledYahtzee:(NSNotification *)notification;
- (void)updateRollButtonWithLast:(BOOL)withLast;
- (void)changeStateTo:(int)state;

#pragma mark Button delegates
- (void)navigationBar:(UINavigationBar*)bar buttonClicked:(int)button;

#pragma mark Alert Sheet
- (void)sendAlertWithContext:(NSString *)context;
- (void)alertSheet:(UIAlertSheet *)sheet buttonClicked:(int)button;

#pragma mark Application Accessors
- (void)setNavBarLeftButton:(NSString *)left withStyle:(int)lstyle rightButton:(NSString *)right withStyle:(int)rstyle;
- (void)setNavBarTitle:(NSString *)newTitle;
- (int)currentState;
- (void)setCurrentState:(int)newCurrentState;
- (int)previousState;
- (void)setPreviousState:(int)newPreviousState;
- (BOOL)playing;
- (void)setPlaying:(BOOL)newPlaying;

#pragma mark Dealloc
- (void)dealloc;

@end
